﻿<%@ Page Title="" Language="C#" MasterPageFile="~/WebmasterTool/Admin.Master" AutoEventWireup="true"
    CodeBehind="GalleryImages.aspx.cs" Inherits="Framework.WebmasterTool.GalleryImages.GalleryImages" %>

<%@ Register Src="../../Controls/simpleImageUploadUserControl/SimpleImageUpload.ascx"
    TagName="SimpleImageUpload" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <script type="text/javascript">
        $(document).ready(function () {
            $(".deleteImage").live("click", function () {
                var callFrom = $(this);
                jConfirm('Chắc chắn xoá?', 'Digisky Confirm Dialog',
                            function (r) {
                                if (r) {
                                    __doPostBack(callFrom.attr('id').replace(/_/g, '$'), '');
                                }
                            });
                return false;
            });
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ctlCaption" runat="Server">
    Thư viện ảnh
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PageContent" runat="Server">
    <asp:Label ID="lblPermissionMessage" runat="server" Font-Bold="true" ForeColor="Red"
        Text="Tài khoản không có quyền truy cập vào trang này" Visible="false"></asp:Label>
    <asp:Panel ID="Panel1" runat="server" Visible="true">
        <div style="text-align: right; margin-bottom: 10px;">
            <asp:Button ID="btnCateGalleryImage" runat="server" Text="Quản lý danh mục thư viện ảnh"
                OnClick="btnCateGalleryImage_Click" />
        </div>
        <div style="padding: 10px; background: #f5f5f5; border: solid 1px #ccc; text-align: center;">
            <div>
                <a href="GalleryImages.aspx?CateID=<%= this.cateParent %>">"Ra ngoài"</a> - <a href='GalleryImages.aspx?CateID=<%= this.cateTop %>'>
                    "Ngoài cùng" - </a>
                <asp:Literal ID="ltrTitleFolder" runat="server"></asp:Literal>
            </div>
            <div style="text-align: center; padding: 10px 10px 10px 25px; float: left;">
                <asp:Repeater ID="rpCateGalleryImage" runat="server">
                    <ItemTemplate>
                        <div style="width: 100px; float: left">
                            <a title='<%# Eval("Title") %>' href='GalleryImages.aspx?CateID=<%# Eval("CateID") %>'>
                                <img style="margin-left: 10px" src="../Images/iconfoder.png" alt="" />
                            </a>
                            <p>
                                <a title='<%# Eval("Title") %>' href='GalleryImages.aspx?CateID=<%# Eval("CateID") %>'>
                                    <%# DGSFramework.Globals.TruncateString(Eval("Title").ToString(), 12) %></a></p>
                        </div>
                    </ItemTemplate>
                </asp:Repeater>
            </div>
            <div style="clear: both">
            </div>
        </div>
        <div style="padding: 10px; background: #f5f5f5; border: solid 1px #ccc; margin-top: 10px;">
            <table align="center" cellpadding="5" cellspacing="0" border="0">
                <tr>
                    <td colspan="2" align="center">
                        <asp:ValidationSummary ID="ValidationSummary1" runat="server" Font-Bold="true" DisplayMode="List"
                            ValidationGroup="GalleryImage" />
                        <asp:Label ID="lblMessage" runat="server" Font-Bold="true" ForeColor="Red"></asp:Label>
                    </td>
                </tr>
                <tr id="Tr1" runat="server">
                    <td align="right" style="font-weight: bold">
                        Tiêu đề:
                    </td>
                    <td align="left">
                        <asp:TextBox ID="txtTitle" runat="server" Width="300" />
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtTitle"
                            Display="Dynamic" ErrorMessage="Chưa nhập tiêu đề cho ảnh" ValidationGroup="GalleryImage">*</asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td align="right" style="font-weight: bold">
                        Tiêu đề(en):
                    </td>
                    <td align="left">
                        <asp:TextBox ID="txtTitle_en" runat="server" Width="300" />
                    </td>
                </tr>
                <tr>
                    <td align="right" style="font-weight: bold">
                        Danh mục thư viện ảnh:
                    </td>
                    <td align="left">
                        <asp:DropDownList ID="ddlCategories" runat="server" DataTextField="Title" DataValueField="CateID"
                            AppendDataBoundItems="true" Width="300">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td align="right" style="font-weight: bold">
                        Upload Hình:<br />
                        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                            <ContentTemplate>
                                <asp:CheckBox ID="chkWatermarkImage" runat="server" Text="Chèn chữ ký:" AutoPostBack="true"
                                    OnCheckedChanged="chkWatermarkImage_CheckedChanged" />
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </td>
                    <td align="left">
                        <uc1:simpleimageupload id="siuUploadImage" runat="server" cssclass="ImageUpload"
                            autoopenimageeditpopupafterupload="true" />
                    </td>
                </tr>
                <tr>
                    <td align="right" style="font-weight: bold">
                        Alt ảnh:
                    </td>
                    <td align="left">
                        <asp:TextBox ID="txtAltImage" runat="server" Width="300"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td align="right" style="font-weight: bold">
                        Mô tả:
                    </td>
                    <td align="left">
                        <CKEditor:CKEditorControl ID="txtDesciption" runat="server" UIColor="#CED9F3" Width="350"
                            Height="200" Toolbar="Basic" BasePath="/Plugins/Ckeditor" ContentsCss="/Plugins/Ckeditor/contents.css"
                            TemplatesFiles="/Plugins/Ckeditor/plugins/templates/templates/default.js"></CKEditor:CKEditorControl>
                    </td>
                </tr>
                <tr>
                    <td align="right" style="font-weight: bold">
                        Mô tả(en):
                    </td>
                    <td align="left">
                        <CKEditor:CKEditorControl ID="txtDesciption_en" runat="server" UIColor="#CED9F3"
                            Width="350" Height="200" Toolbar="Basic" BasePath="/Plugins/Ckeditor" ContentsCss="/Plugins/Ckeditor/contents.css"
                            TemplatesFiles="/Plugins/Ckeditor/plugins/templates/templates/default.js"></CKEditor:CKEditorControl>
                    </td>
                </tr>
                <tr>
                    <td align="right" style="font-weight: bold">
                        Vị trí:
                    </td>
                    <td align="left">
                        <asp:TextBox ID="txtDisplayOrder" runat="server" Width="300" Text="0"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Chưa nhập vị trí cho ảnh"
                            ControlToValidate="txtDisplayOrder" ValidationGroup="GalleryImage" Display="Dynamic">*</asp:RequiredFieldValidator>
                        <asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="txtDisplayOrder"
                            Type="Integer" MinimumValue="0" MaximumValue="9999" ValidationGroup="GalleryImage"
                            ErrorMessage="Vị trí ảnh phải từ 0 đến 9999" Display="Dynamic">*</asp:RangeValidator>
                    </td>
                </tr>
                <tr>
                    <td align="right" style="font-weight: bold">
                        Hiện thị
                    </td>
                    <td align="left">
                        <asp:CheckBox Text="Hiển thị" ID="chkIsActive" runat="server" Checked="true" />
                    </td>
                </tr>
                <tr>
                    <td align="right" style="font-weight: bold">
                        Hiển thị nổi bật
                    </td>
                    <td align="left">
                        <asp:CheckBox Text="Hiển thị nổi bật" ID="chkIsTop" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td align="right" style="font-weight: bold">
                        Ngày tạo:
                    </td>
                    <td align="left">
                        <asp:Label ID="lblAddedDate" runat="server" Text="None"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td align="right" style="font-weight: bold">
                        Người tạo:
                    </td>
                    <td align="left">
                        <asp:Label ID="lblAddedBy" runat="server" Text="None"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td align="right" style="font-weight: bold">
                        Ngày update:
                    </td>
                    <td align="left">
                        <asp:Label ID="lblUpdatedDate" runat="server" Text="None"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td align="right" style="font-weight: bold">
                        Người update:
                    </td>
                    <td align="left">
                        <asp:Label ID="lblUpdatedBy" runat="server" Text="None"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" align="right">
                        <asp:Button ID="btnNew" runat="server" Text="Thêm mới" Width="80" OnClick="btnNew_Click"
                            Visible="false" />
                        <asp:Button ID="btnSave" runat="server" ValidationGroup="GalleryImage" Text=" Lưu "
                            Width="80" OnClick="btnSave_Click" />
                    </td>
                </tr>
            </table>
        </div>
        <div style="padding: 10px; background: #f5f5f5; border: solid 1px #ccc; margin-top: 10px;">
            <div style="float: left; padding-left: 21px;">
                <asp:Repeater ID="rpImages" runat="server">
                    <ItemTemplate>
                        <div style="width: 120px; float: left; text-align: center;">
                            <img style="width: 100px; height: 100px" src='<%# DGSFramework.ConfigPaths.Path_GalleryImage_Folder.Substring(1) + Eval("ImageUrl") %>'
                                alt="" />
                            <asp:LinkButton ID="lkbDeleteImage" runat="server" Text="Xoá" CssClass="deleteImage"
                                CommandArgument='<%# Eval("ImageID") %>' OnClick="lkbDeleteImage_Click"></asp:LinkButton>
                            - <a title="Chi tiết" href='GalleryImages.aspx?CateID=<%= cateAlbum %>&ImageID=<%# Eval("ImageID") %>'>
                                Sửa</a>
                        </div>
                    </ItemTemplate>
                </asp:Repeater>
            </div>
            <div style="clear: both">
            </div>
        </div>
    </asp:Panel>
</asp:Content>
